<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简单计算器</title>
</head>
<body>
<input id="num_a" type="number" style="width: 50px;height: 20px;">


<label for="op"></label><select id="op">
    <option value="+">+</option>
    <option value="-">-</option>
    <option value="*">*</option>
    <option value="/">/</option>
</select>


<input id="num_b" type="number" style="width: 50px;height: 20px;">
<span>=</span>
<input id="num_c" type="number" disabled style="width: 50px;height: 20px;">

<button id="submit">等于</button>
</body>
<script>
    document.getElementById("submit").onclick = function () {
        let a, b, c, d
        a = document.getElementById("num_a").value
        b = document.getElementById("num_b").value
        d = document.getElementById("op").value

        switch (d) {
            case "+":
                c = Number(a) + Number(b)
                break
            case "-":
                c = Number(a) - Number(b)
                break
            case "*":
                c = Number(a) * Number(b)
                break
            case "/":
                c = Number(a) / Number(b)
                break
        }

        document.getElementById("num_c").value = c
    }
</script>
</html>